<!DOCTYPE html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <title>UseEcos &mdash; CMake 4.1.1 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=4d06bd55" />
    
    <script src="../_static/documentation_options.js?v=e6a937a4"></script>
    <script src="../_static/doctools.js?v=9bcbadda"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    
    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="UseJava" href="UseJava.html" />
    <link rel="prev" title="TestForSTDNamespace" href="TestForSTDNamespace.html" />
 

  </head><body>
    <input id="sidebar-check" type="checkbox" />
    <label id="sidebar-overlay" for="sidebar-check"></label>



    <div class="related relbar1" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="UseJava.html" title="UseJava"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="TestForSTDNamespace.html" title="TestForSTDNamespace"
             accesskey="P">previous</a> |</li>
  <li>
    <label class="sidebar-toggle" for="sidebar-check"></label>
  </li>
  <li class="rootlink">
    <img src="../_static/cmake-logo-16.png" width="16" height="16" alt=""/>
    <a href="https://cmake.org/">CMake 4.1.1</a>
    <span class="reldelim1"> &#187;</span>
  </li>
  <li>
    <a href="../index.html">Documentation</a> &#187;
  </li>

          <li class="nav-item nav-item-1"><a href="../manual/cmake-modules.7.html" accesskey="U">cmake-modules(7)</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">UseEcos</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="useecos">
<span id="module:UseEcos"></span><h1>UseEcos<a class="headerlink" href="#useecos" title="Link to this heading">¶</a></h1>
<p>This module defines variables and provides commands required to build an eCos
application.</p>
<p>Load this module in CMake project with:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">include(</span><span class="nb">UseEcos</span><span class="nf">)</span>
</pre></div>
</div>
<section id="commands">
<h2>Commands<a class="headerlink" href="#commands" title="Link to this heading">¶</a></h2>
<p>This module provides the following commands:</p>
<section id="building-an-ecos-application">
<h3>Building an eCos Application<a class="headerlink" href="#building-an-ecos-application" title="Link to this heading">¶</a></h3>
<dl class="cmake command">
<dt class="sig sig-object cmake" id="command:ecos_add_include_directories">
<span class="sig-name descname"><span class="pre">ecos_add_include_directories</span></span><a class="headerlink" href="#command:ecos_add_include_directories" title="Link to this definition">¶</a></dt>
<dd><p>Adds the eCos include directories for the current <code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code> file:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ecos_add_include_directories()</span>
</pre></div>
</div>
</dd></dl>

<dl class="cmake command">
<dt class="sig sig-object cmake" id="command:ecos_adjust_directory">
<span class="sig-name descname"><span class="pre">ecos_adjust_directory</span></span><a class="headerlink" href="#command:ecos_adjust_directory" title="Link to this definition">¶</a></dt>
<dd><p>Adjusts the paths of given source files:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ecos_adjust_directory(</span><span class="nv">&lt;var&gt;</span><span class="w"> </span><span class="nv">&lt;sources&gt;...</span><span class="nf">)</span>
</pre></div>
</div>
<p>This command modifies the paths of the source files <code class="docutils literal notranslate"><span class="pre">&lt;sources&gt;...</span></code> to
make them suitable for use with <code class="docutils literal notranslate"><span class="pre">ecos_add_executable()</span></code>, and stores them
in the variable <code class="docutils literal notranslate"><span class="pre">&lt;var&gt;</span></code>.</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">&lt;var&gt;</span></code></dt><dd><p>Result variable name holding a new list of source files with adjusted paths.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&lt;sources&gt;...</span></code></dt><dd><p>A list of relative or absolute source files to adjust their paths.</p>
</dd>
</dl>
<p>Use this command when the actual sources are located one level upwards. A
<code class="docutils literal notranslate"><span class="pre">../</span></code> has to be prepended in front of every source file that is given as a
relative path.</p>
</dd></dl>

<dl class="cmake command">
<dt class="sig sig-object cmake" id="command:ecos_add_executable">
<span class="sig-name descname"><span class="pre">ecos_add_executable</span></span><a class="headerlink" href="#command:ecos_add_executable" title="Link to this definition">¶</a></dt>
<dd><p>Creates an eCos application executable:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ecos_add_executable(</span><span class="nv">&lt;name&gt;</span><span class="w"> </span><span class="nv">&lt;sources&gt;...</span><span class="nf">)</span>
</pre></div>
</div>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code></dt><dd><p>The name of the executable.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&lt;sources&gt;...</span></code></dt><dd><p>A list of all source files, where the path has been adjusted beforehand by
calling the <code class="docutils literal notranslate"><span class="pre">ecos_adjust_directory()</span></code>.</p>
</dd>
</dl>
<p>This command also sets the <code class="docutils literal notranslate"><span class="pre">ECOS_DEFINITIONS</span></code> local variable, holding some
common compile definitions.</p>
</dd></dl>

</section>
<section id="selecting-the-toolchain">
<h3>Selecting the Toolchain<a class="headerlink" href="#selecting-the-toolchain" title="Link to this heading">¶</a></h3>
<dl class="cmake command">
<dt class="sig sig-object cmake" id="command:ecos_use_arm_elf_tools">
<span class="sig-name descname"><span class="pre">ecos_use_arm_elf_tools</span></span><a class="headerlink" href="#command:ecos_use_arm_elf_tools" title="Link to this definition">¶</a></dt>
<dd><p>Enables the ARM ELF toolchain for the directory where it is called:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ecos_use_arm_elf_tools()</span>
</pre></div>
</div>
<p>Use this command, when compiling for the xscale processor.</p>
</dd></dl>

<dl class="cmake command">
<dt class="sig sig-object cmake" id="command:ecos_use_i386_elf_tools">
<span class="sig-name descname"><span class="pre">ecos_use_i386_elf_tools</span></span><a class="headerlink" href="#command:ecos_use_i386_elf_tools" title="Link to this definition">¶</a></dt>
<dd><p>Enables the i386 ELF toolchain for the directory where it is called:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ecos_use_i386_elf_tools()</span>
</pre></div>
</div>
</dd></dl>

<dl class="cmake command">
<dt class="sig sig-object cmake" id="command:ecos_use_ppc_eabi_tools">
<span class="sig-name descname"><span class="pre">ecos_use_ppc_eabi_tools</span></span><a class="headerlink" href="#command:ecos_use_ppc_eabi_tools" title="Link to this definition">¶</a></dt>
<dd><p>Enables the PowerPC toolchain for the directory where it is called:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">ecos_use_ppc_eabi_tools()</span>
</pre></div>
</div>
</dd></dl>

</section>
</section>
<section id="variables">
<h2>Variables<a class="headerlink" href="#variables" title="Link to this heading">¶</a></h2>
<p>This module also defines the following variables:</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">ECOSCONFIG_EXECUTABLE</span></code></dt><dd><p>Cache variable that contains a path to the <code class="docutils literal notranslate"><span class="pre">ecosconfig</span></code> executable (the eCos
configuration program).</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">ECOS_CONFIG_FILE</span></code></dt><dd><p>A local variable that defaults to <code class="docutils literal notranslate"><span class="pre">ecos.ecc</span></code>.  If eCos configuration file
has a different name, adjust this variable before calling the
<code class="docutils literal notranslate"><span class="pre">ecos_add_executable()</span></code>.</p>
</dd>
</dl>
</section>
<section id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Link to this heading">¶</a></h2>
<p>The following example demonstrates defining an eCos executable target in a
project that follows the common eCos convention of listing source files in
a <code class="docutils literal notranslate"><span class="pre">ProjectSources.txt</span></code> file, located one directory above the current
<code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code>:</p>
<div class="literal-block-wrapper docutils container" id="id1">
<div class="code-block-caption"><span class="caption-text"><code class="docutils literal notranslate"><span class="pre">CMakeLists.txt</span></code></span><a class="headerlink" href="#id1" title="Link to this code">¶</a></div>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">include(</span><span class="nb">UseEcos</span><span class="nf">)</span>

<span class="c"># Add the eCos include directories.</span>
<span class="nf">ecos_add_include_directories()</span>

<span class="c"># Include the file with the eCos sources list. This file, for example, defines</span>
<span class="c"># a list of eCos sources:</span>
<span class="c">#   set(sources file_1.cxx file_2.cxx file_3.cxx)</span>
<span class="nf">include(</span><span class="p">..</span><span class="na">/ProjectSources.txt</span><span class="nf">)</span>

<span class="c"># When using such directory structure, relative source paths must be adjusted:</span>
<span class="nf">ecos_adjust_directory(</span><span class="nb">adjusted_sources</span><span class="w"> </span><span class="o">${</span><span class="nt">sources</span><span class="o">}</span><span class="nf">)</span>

<span class="c"># Create eCos executable.</span>
<span class="nf">ecos_add_executable(</span><span class="nb">ecos_app</span><span class="w"> </span><span class="o">${</span><span class="nt">adjusted_sources</span><span class="o">}</span><span class="nf">)</span>
</pre></div>
</div>
</div>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
  <div>
    <h3>Table of Contents</h3>
    <ul>
<li><a class="reference internal" href="#">UseEcos</a><ul>
<li><a class="reference internal" href="#commands">Commands</a><ul>
<li><a class="reference internal" href="#building-an-ecos-application">Building an eCos Application</a></li>
<li><a class="reference internal" href="#selecting-the-toolchain">Selecting the Toolchain</a></li>
</ul>
</li>
<li><a class="reference internal" href="#variables">Variables</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
</ul>

  </div>
  <div>
    <h4>Previous topic</h4>
    <p class="topless"><a href="TestForSTDNamespace.html"
                          title="previous chapter">TestForSTDNamespace</a></p>
  </div>
  <div>
    <h4>Next topic</h4>
    <p class="topless"><a href="UseJava.html"
                          title="next chapter">UseJava</a></p>
  </div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/module/UseEcos.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="UseJava.html" title="UseJava"
             >next</a> |</li>
        <li class="right" >
          <a href="TestForSTDNamespace.html" title="TestForSTDNamespace"
             >previous</a> |</li>
  <li>
    <label class="sidebar-toggle" for="sidebar-check"></label>
  </li>
  <li class="rootlink">
    <img src="../_static/cmake-logo-16.png" width="16" height="16" alt=""/>
    <a href="https://cmake.org/">CMake 4.1.1</a>
    <span class="reldelim1"> &#187;</span>
  </li>
  <li>
    <a href="../index.html">Documentation</a> &#187;
  </li>

          <li class="nav-item nav-item-1"><a href="../manual/cmake-modules.7.html" >cmake-modules(7)</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">UseEcos</a></li> 
      </ul>
    </div>

    <div class="footer" role="contentinfo">
    &#169; Copyright 2000-2025 Kitware, Inc. and Contributors.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3.
    </div>
<script type="text/javascript">
(function() {
  "use strict";
  const hide = () => document.getElementById("sidebar-check").checked = false;
  addEventListener("keydown", e => (e.key === "Escape") && hide());
  addEventListener("click", e => (e.target.tagName === "A") && hide());
  addEventListener("hashchange", hide)
})();
</script>
  </body>
</html>